<!DOCTYPE html>
<html lang="zh-Hans">
<head>
    @import "mate.html"
    <title>个人认证信息</title>
    <link rel="stylesheet" href="../assets/weui/lib/weui.min.css">
    <link rel="stylesheet" href="../assets/weui/css/jquery-weui.min.css">
    <link rel="stylesheet" href="../css/style.min.css">
</head>
<body>
<div class="header">
    <div class="user-img">
        <img src="../images/user-img.png" alt="">
    </div>
    <div class="user-name">ID9527</div>
    <div class="user-info">
        <!--<div class="certification">
            &lt;!&ndash;<i class="cert-no-icon"></i><span class="cert-text">未认证</span>&ndash;&gt;
            <i class="cert-yes-icon"></i><span class="cert-text">已认证</span>
        </div>-->
        <div class="safe" style="text-align: center">
            <span class="safe-level">安全等级：</span>
            <em class="red">低</em>
            <!--<em class="yellow">中</em>-->
            <!--<em class="green">高</em>-->
        </div>
    </div>
</div>
<div class="type-title"><i class="user-info-icon"></i><span>基本信息</span></div>
<div id="cert-form">
    <div class="weui-cells weui-cells_form tax-form">
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">姓名</label></div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" value="某某某" name="username" readonly>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">身份证件</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" value="身份证" readonly>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">证件号码</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="text" value="330501199905050658" readonly>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd">
                <label class="weui-label">手机号</label>
            </div>
            <div class="weui-cell__bd">
                <input class="weui-input" type="tel" value="15757857520" readonly>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">信用等级</label></div>
            <div class="weui-cell__bd">
                <div class="fl" style="line-height: 30px">
                    <span>A</span>
                </div>
                <a href="" class="fr weui-btn weui-btn_mini small-btn">刷新</a>
            </div>
        </div>
        <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">认证状态</label></div>
            <div class="weui-cell__bd">
                <div class="fl" style="line-height: 30px">
                    <i class="cert-no-icon"></i><span class="cert-text-no">未认证</span>
                    <!--<i class="cert-yes-icon"></i><span class="cert-text">已认证</span>-->
                </div>
                <a href="certification.html" class="fr weui-btn weui-btn_mini small-btn">去认证</a>
            </div>
        </div>
    </div>
</div>
<div class="weui-cells">
    <a class="weui-cell weui-cell_access" href="personInfoAdd.html">
        <div class="weui-cell__bd">
            <p>个人补充信息</p>
        </div>
        <span class="weui-badge">9</span>
        <div class="weui-cell__ft"></div>
    </a>
    <a class="weui-cell weui-cell_access" href="investors.html">
        <div class="weui-cell__bd">
            <p>投资者纳税人信息</p>
        </div>
        <span class="weui-badge">5</span>
        <div class="weui-cell__ft"></div>
    </a>
    <a class="weui-cell weui-cell_access" href="nohome.html">
        <div class="weui-cell__bd">
            <p>无住所纳税人信息</p>
        </div>
        <span class="weui-badge">2</span>
        <div class="weui-cell__ft"></div>
    </a>
</div>
<div style="height: 60px;"></div>
<div class="weui-tabbar" style="position: fixed;">
    <a href="javascript:;" class="weui-tabbar__item weui-bar__item--on">
        <div class="weui-tabbar__icon navicon-one"></div>
        <p class="weui-tabbar__label">首页</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item">
        <div class="weui-tabbar__icon navicon-two"></div>
        <p class="weui-tabbar__label">办税</p>
    </a>
    <a href="javascript:;" class="weui-tabbar__item">
        <div class="weui-tabbar__icon navicon-thr"></div>
        <p class="weui-tabbar__label">实名认证</p>
    </a>
</div>

@import "footer.html"
<script src="../assets/nice/jquery.validator.min.js"></script>
<script>
    $(function () {
      (function () {
//        验证码效果
        $('#yz-code').on('click',function (e) {
          e.stopPropagation();
          var timeNum=5;
          $(this).text(timeNum+'秒后再获取').attr('disabled', true);
          timeNum--;
          var timer=setInterval(function () {
            if(timeNum>0){
              $(this).text(timeNum+'秒后再获取').attr('disabled', true);
              timeNum--;
//            业务逻辑

            }else {
              clearInterval(timer);
              timer=null;
              $(this).text('获取验证码').attr('disabled',false);
            }
          }.bind(this),1000)
        });
      })();

      (function () {
//        选择框
        /*$('#ID-card').select({
          title: "选择证件类型",
          items: [{
            title:"身份证",
            value: 1
          },{
            title:"学生证",
            value:2
          },{
            title:"残疾证",
            value:3
          }],
          onChange:function (sel) {
            console.log(sel);
            if(sel.values==='2'){
              $('#idNum').attr('name','lala');
            }else if(sel.values==='1'){
              $('#idNum').attr('name','idcard');
            }
          }
        });
        $('#project').select({
          title: "选择申报项目",
          items: [{
            title:"第一个项目",
            value: 1
          },{
            title:"第二个项目",
            value:2
          },{
            title:"第三个项目",
            value:3
          }]
        });*/
        $('#idType').change(function () {
//          console.log($(this).val());
          if(parseInt($(this).val())===1){
            $('#idNum').attr('name','idcard');
          }else if(parseInt($(this).val())===2){
            $('#idNum').attr('name','idcard');
          }
        })

      })();

      (function () {
//        表单校验
        var formObj=$('#cert-form');
        formObj.validator({
          timely:0,
          focusCleanup:true,
          rules: {
            mobile: /^1[3458]\d{9}$/,
            money: /^(?:0|[1-9]\d*)(?:\.\d{1,2})?$/,
            idcard: function(element) {
              var value = element.value,
                isValid = true;
              var cityCode = {11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江 ",31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北 ",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏 ",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外 "};
              var rFormat =/^\d{6}(19|20)\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}(\d|X)$|^\d{6}\d{2}(0[1-9]|1[012])(0[1-9]|[12]\d|3[01])\d{3}$/;    // 格式验证
              if ( !rFormat.test(value) || !cityCode[value.substr(0,2)] ) {
                isValid = false;
              } else if (value.length === 18) {
                var Wi = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2, 1 ];
                var Ci = "10X98765432";
                var sum = 0;
                for (var i = 0; i < 17; i++) {
                  sum += value.charAt(i) * Wi[i];
                }
                var C17 = Ci.charAt(sum % 11);
                if ( C17 !== value.charAt(17) ) {
                  isValid =false;
                }
              }
              return isValid;
            }
          },
          fields: {
            username: "required",
            idType: "required",
            idcard: "required;idcard",
            mobile: "required;mobile",
            yzCode: "required",
            project: "required",
            money: "required;money",
            unit: "required"
          },
          valid: function(form) {
            var data=$(form).serialize();
            console.log(data);
            $.post("url...",data)
              .done(function(){
                //业务逻辑
              });
          }
        });
        formObj.on('validation', function(e, current){
          if(current.isValid){
            $(current.element).parents('.weui-cell').removeClass('weui-cell_warn');
          }else {
            $(current.element).parents('.weui-cell').addClass('weui-cell_warn');
          }
        });
      })();

    });
</script>
</body>
</html>